import request from '@/utils/request'

export function list(params) {
  return request({
    url: '/table',
    method: 'get',
    params
  })
}

export function read(id) {
  return request({
    url: `/table/${id}`,
    method: 'get'
  })
}

export function edit(id) {
  return request({
    url: `/table/${id}/edit`,
    method: 'get'
  })
}

export function save(params) {
  return request({
    url: `/table`,
    method: 'post',
    data: params
  })
}

export function update(id, data) {
  return request({
    url: `/table/${id}`,
    method: 'put',
    data: {
      field: data
    }
  })
}

export function destroy(id) {
  return request({
    url: `/table/${id}`,
    method: 'DELETE'
  })
}

export function unshowList(id) {
  return request({
    url: `/table/unshow`,
    method: 'get',
    params: {
      id: id
    }
  })
}

export function setUnshow(data) {
  return request({
    url: `/table/unshow`,
    method: 'post',
    data
  })
}
